<?php

use common\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
use common\enums\StatusEnum;

/* @var $this yii\web\View */
/* @var $form yii\widgets\ActiveForm */

$this->title = '审核进度';
$this->params['breadcrumbs'][] = ['label' => '报销申请', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
//Yii::$app->debris->p($model->getWorkflowStatus()->getId());
//Yii::$app->debris->p($model->getNextStatuses());
$status = true;
foreach ($model->getNextStatuses() as $key => $nextStatus) {
    $status = false;
}
//Yii::$app->debris->p($status);

?>

<div class="row">
    <div class="col-lg-12">
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title">审核进度</h3>
            </div>
            <div class="box-body">
                <?php $form = ActiveForm::begin(); ?>
                <div class="row">
                    <div class="col-sm-12">
                        <ul class="timeline">
                            <li class="time-label">
                          <span class="bg-blue">
                            审核开始
                          </span>
                            </li>
                            <?php
                            foreach ($model->log ?? [] as $log) {
                                ?>
                                <li>
                                    <i class="fa fa-user bg-blue"></i>
                                    <div class="timeline-item">
                                        <span class="time"><i
                                                    class="fa fa-clock-o"></i> <?= date("Y-m-d H:i:s", $log->time) ?></span>
                                        <h3 class="timeline-header"><?= Yii::$app->merchantsService->member->getName($log->id) ?> <?= \addons\Flow\common\enums\WorkflowEnum::getValue(explode('/', $log->action)[1]) ?></h3>
                                        <div class="timeline-body">
                                            <?= $log->suggest??$model->content; ?>
                                        </div>
                                    </div>
                                </li>
                                <?php
                            }
                            ?>

                            <?php if ($status) { ?>
                                <li class="time-label">
                              <span class="bg-yellow">
                                审核结束
                              </span>
                                </li>
                            <?php } else { ?>
                                <li>
                                    <i class="fa fa-clock-o bg-gray"></i>
                                </li>
                            <?php } ?>
                        </ul>

                    </div>
                </div>

                <?php ActiveForm::end(); ?>
            </div>
        </div>
    </div>
</div>

